fix(security): escape customData fields in option aria-label (XSS bypass)#470
Closed
gnbm wants to merge 1 commit into
Closed
fix(security): escape customData fields in option aria-label (XSS bypass)#470gnbm wants to merge 1 commit into
gnbm wants to merge 1 commit into
Conversation
customData.group_name and customData.description were interpolated directly into the option aria-label attribute without escaping. A double quote in those fields could break out of the attribute and inject markup/handlers even when enableSecureText was enabled - an XSS bypass. Route both fields through secureText() (same path as label/value). secureText is a no-op when enableSecureText is disabled, so behaviour is unchanged for consumers that intentionally pass raw text. Adds cypress regression spec security-customdata-xss.cy.ts.
Collaborator
Author
|
Closing as already resolved on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
customData.group_nameandcustomData.descriptionare interpolated straight into the optionaria-labelattribute inrenderOptions()without escaping:A
"in either field breaks out of the attribute and can inject markup / event handlers — and this happens even whenenableSecureTextis enabled, sincecustomDatanever went throughsecureText(). That makes it an XSS bypass for security-conscious consumers.Fix
Route both
customDatafields throughsecureText()(the same escaping used forlabel/value).secureText()is a no-op whenenableSecureTextis disabled, so behaviour is unchanged for consumers that intentionally pass raw text.Verification
New spec
cypress/e2e/security-customdata-xss.cy.ts:customData(withenableSecureText: true) and asserts no<img>is injected and theonerrornever runs;aria-labelstays intact (escaped, not broken out).Other Validations:
npm run validatefor static code validation:npm run build: succeeds;dist/docsrebuiltnpm run test):